package weixinkeji.dev.dc.buy.order.h.manager;

import sys.wx.ann.hm.M;
import sys.wx.c.ATR;
import sys.wx.c.components.check.bean.CheckData;
import sys.wx.c.components.cv.CV;
import sys.wx.m.db.dao.mysql.Dao;
import weixinkeji.dev.dc.buy.order.bean.FWYOrderB;
import weixinkeji.dev.dc.buy.order.so.FWYOrderSO;
import weixinkeji.dev.dc.buy.order.xy.FWYOrderXY;

@sys.wx.ann.hm.H("view/buy/order/manager/fwy/d")

public class ManagerFWYOrderD {

    @M("/dellbackFood")//通过 view/buy/order/manager/fwy/d/dellbackFood.imy 访问
    public static String ubackFood(ATR a) {
        String bid = CV.getParameter(a.request, "bid", CheckData.ID);
        if (null == bid) {
            return null;
        }
        FWYOrderB s = Dao.selectOneByID(FWYOrderB.class, bid);
        if (FWYOrderSO.checkOrderIsLock(s.getOrder_id())) {
            a.out_OK_NO(false, "订单已经付款，无法执行退菜操作");
            return null;
        }
        if (s.getBuy_number() > 0) {
            a.out_OK_NO(false, "删除的不是退单，操作无法完成。");
            return null;
        }
        a.out_OK_NO(FWYOrderSO.dellOrderB(s.getOrder_id(), bid));
        return null;
    }

    @M("/dellLockFood")//通过 view/buy/order/manager/fwy/d/dellLockFood.imy 访问
    public static String dLockFood(ATR a) {
        String bid = CV.getParameter(a.request, "bid", CheckData.ID);
        if (null == bid) {
            return null;
        }
        FWYOrderB s = Dao.selectOneByID(FWYOrderB.class, bid);
        switch (s.getOrderb_style()) {
            case FWYOrderXY.B_STYLE_1:
            case FWYOrderXY.B_STYLE_2: {
                a.out_OK_NO(FWYOrderSO.dellOrderB(s.getOrder_id(), bid));
                return null;
            }
            default: {
                return null;
            }
        }
    }
}
